<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<%@ include file="/common/include.jsp"%>
<link href="/summer/template/admin/css/input.css" rel="stylesheet"
	type="text/css" />
<link href="/summer/template/admin/css/input.css" rel="stylesheet" type="text/css" />
<meta name="Author" content="SHOP++ Team" />
<meta name="Copyright" content="SUMMER" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<script type="text/javascript">

function showTips( tips, height, time ){ 
var windowWidth = document.documentElement.clientWidth; 
var tipsDiv = '<div class="tipsClass">' + tips + '</div>'; 

$( 'body' ).append( tipsDiv ); 
$( 'div.tipsClass' ).css({ 
'top' : height + 'px', 
'left' : ( windowWidth / 2 ) - ( tips.length * 13 / 2 ) + 'px', 
'position' : 'absolute', 
'padding' : '3px 5px', 
'background': '#8FBC8F', 
'font-size' : 12 + 'px', 
'margin' : '0 auto', 
'text-align': 'center', 
'width' : 'auto', 
'color' : '#fff', 
'opacity' : '0.8' 
}).show(); 

setTimeout( function(){$( 'div.tipsClass' ).fadeOut();}, ( time * 1000 ) ); 
} 


$().ready( function() {

	$saveButton=$(".input input.saveButton");
	$createCodeButton=$(".input input.createCodeButton");
	
	// 保存
	$saveButton.click( function() {
		var url = $(this).attr("url");
		var params=$("#inputForm").serialize();
		//params = encodeURI(params,"UTF-8"); 
		
		if (confirm("您确定要保存吗？") == true) {
			$.ajax({
				url: url,
				data: params,
				dataType: "json",
				type: "post", //可以避免get方式提交乱码
				async: false,
				beforeSend: function(data) {
					$saveButton.attr("disabled", true)
				},
				success: function(data) {
					$saveButton.attr("disabled", false)
					if (data.status == "success") {
						showTips( data.message, 100, 3 );
					}
					$.message(data.status, data.message);
				}
			});
		}
	});


	// 保存
	$createCodeButton.click( function() {
		var url = $(this).attr("url");
		var params=$("#inputForm").serialize();
		//params = encodeURI(params,"UTF-8"); 
		
		if (confirm("您确定要创建代码和页面么？") == true) {
			$.ajax({
				url: url,
				data: params,
				dataType: "json",
				type: "post", //可以避免get方式提交乱码
				async: false,
				beforeSend: function(data) {
					$createCodeButton.attr("disabled", true)
				},
				success: function(data) {
					$createCodeButton.attr("disabled", false)
					if (data.status == "success") {
						showTips( data.message, 100, 3 );
					}
					$.message(data.status, data.message);
				}
			});
		}
	});

	
});


</script>
</head>


<body class="input" >

	<div class="body">
				<div class="inputBar">
				<table >
				<tr>
				<td width="30%"><h1><span class="icon">&nbsp;</span>表配置信息<a href="javascript:void(0);" onclick="showTips( '操作成功', 100, 3 );">点击</a>
</h1></div></td>
				<td width="30%">
				<ul class="tab">
				<li>
					<input class="saveButton" url="table!update.action" type="button" value="保存更新" hidefocus="true"  />
				</li>
				<li>
					<input class="createCodeButton" type="button" url="table!createCode.action" value="代码生成" hidefocus="true" />
				</li>
				<li>
					<input type="button" value="关联信息" hidefocus="true" />
				</li>
			</ul></td>
				
			</tr>
			
			</table>
		</div>
			

		<form id="inputForm" class="validate" action="<s:if test="id==null">goods!save.action</s:if><s:else>goods!update.action</s:else>" method="post">
			<input type="hidden" name="redirectionUrl" value="table!list.action" />
			<input type="hidden" name="STable.id" value="${id}" />
			<table class="inputTable tabContent">
				<tr>
					<th>
						Bean名称:
					</th>
					<td>
						<input type="text" class="formText" name="sTable.name" style="width:300px"  value="${sTable.name}" />
					</td>
					<th>
						模块名称(中文):
					</th>
					<td>
							<input type="text" class="formText" id="sTable.cnName" name="sTable.cnName" style="width:300px"  value="${sTable.cnName}" />
					</td>
				</tr>
				
				<tr>
					<th>
						Bean路径:
					</th>
					
					<td>
						<input type="text" class="formText" name="sTable.className" style="width:300px"  value="${sTable.className}" />
					</td>
					<th>
						模块访问路径:
					</th>
					<td>
							<input type="text" class="formText" name="sTable.path" style="width:300px"  value="${sTable.path}" />
					</td>
				</tr>
					<tr>
					<th>
						排序属性:
					</th>
					
					<td>
						<input type="text" class="formText" name="sTable.orderBy" style="width:300px"  value="${sTable.orderBy}" />
					</td>
					<th>
						排序方式:
					</th>
					<td>
							<input type="text" class="formText" name="sTable.orderType" style="width:300px"  value="${sTable.ordertype}" />
					</td>
				</tr>
			</table>
			
			
		</form>
	</div>
	
	<s:debug></s:debug>
</body>
</html>